export const increaseClick= ()=>{
    return{
        type:'INCREASE'
    }
};

export const decreaseClick= ()=>{
    return{
        type:'DECREASE'
    }
};

export const getListData=(data)=>{
    // console.log(111,data)
    return{
        type:'GET_DATA',
        payload:data,
    }

};
export const addToCard=(data)=>{
    return{
        type:"ADDTOCART",
        data
    }
};
export function addToCart(product={id:0}){
    return dispatch=>{
        dispatch(addToCard(product.id));
    }
}
export function getdata(params={page:1}){
        
     var start=(params.page-1)*20
   
    return dispatch=>{
        return fetch('http://api.douban.com/v2/movie/top250?start='+start)
        .then(res=>{
            return res.json()
        })
        .then(data=>{
            dispatch(getListData(data));
           //tijiao 
        })
    }
}


